﻿/*
 * Created by SharpDevelop.
 * User: Edward Wilde (http://blogs.charteris.com/edwardw)
 * Date: 18/07/2007
 * Time: 18:28
 */

using System;
using System.Globalization;
using System.Runtime.Serialization;

namespace Wax
{
	/// <summary>
	/// FindMethodException can occurs if a <see cref="FindMethod.Execute" /> fails to find the specified element.
	/// </summary>
	[Serializable]
	public class FindMethodException : Exception
	{
		/// <summary>
		/// Creates a new instace of the <see cref="FindMethodException"/> class
		/// </summary>
		public FindMethodException() : base()
		{
		}

        /// <summary>
        /// Initializes a new instance of the <see cref="FindMethodException"/> class.
        /// </summary>
        /// <param name="message">The message.</param>
		public FindMethodException(string message) : base(message)
		{
		}

        /// <summary>
        /// Initializes a new instance of the <see cref="FindMethodException"/> class.
        /// </summary>
        /// <param name="message">The message.</param>
        /// <param name="innerException">The inner exception.</param>
		public FindMethodException(string message, Exception innerException) : base(message, innerException)
		{
			
		}

        /// <summary>
        /// Initializes a new instance of the <see cref="FindMethodException"/> class.
        /// </summary>
        /// <param name="elementName">Name of the element.</param>
        /// <param name="findMethodName">Name of the find method.</param>
        /// <param name="findMethodArgs">The find method args.</param>
		public FindMethodException(string elementName, string findMethodName, string findMethodArgs) : base(string.Format(CultureInfo.InvariantCulture, "Unable to find the element {0} using {1} with the following arguments {0}, {2}", elementName, findMethodName, findMethodArgs))
		{
		
		}

        /// <summary>
        /// Initializes a new instance of the <see cref="FindMethodException"/> class.
        /// </summary>
        /// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo"></see> that holds the serialized object data about the exception being thrown.</param>
        /// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext"></see> that contains contextual information about the source or destination.</param>
        /// <exception cref="T:System.Runtime.Serialization.SerializationException">The class name is null or <see cref="P:System.Exception.HResult"></see> is zero (0). </exception>
        /// <exception cref="T:System.ArgumentNullException">The info parameter is null. </exception>
		protected FindMethodException(SerializationInfo info, StreamingContext context) : base(info, context)
		{
			
		}
	}
}
